home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 5658 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: news.ccs.queensu.ca!news
  2. From: Wintermute <3mal5@qlink.queensu.ca>
  3. Newsgroups: comp.windows.x.motif,comp.lang.c++
  4. Subject: MOTIF Callbacks, C++ Member Functions - SOLVED
  5. Date: 6 Feb 1996 05:18:22 GMT
  6. Organization: System Infinity
  7. Distribution: inet
  8. Message-ID: <4f6oau$c4m@knot.queensu.ca>
  9. NNTP-Posting-Host: free1-slip204.tele.queensu.ca
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.1N (Macintosh; I; 68K)
  14. X-URL: news:comp.windows.x.motif/43382-43481#4f5ojb$ofl@newshound.csrv.uidaho.edu
  15.  
  16. In case anyone's curious, I have implemented the suggestion I received 
  17. and it works beautifully.  The problem was wrapping C++ classes around 
  18. Motif widgets and wanting to use class member functions as callbacks:  
  19. the implicit 'this' parameter of course made this impossible.
  20.  
  21. The solution was to declare a static member function which is used as a 
  22. callback.  Since it is static, there is no 'this' pointer, and it works 
  23. fine.  To access the particular class instance, pass the 'this' pointer 
  24. as client data when installing the callback, and it will be available 
  25. when the static member function is called back.  (I use it to call 
  26. another member function, but it could be used directly.)
  27.  
  28. Thanks to all who helped.
  29.  
  30. --
  31. Wintermute  <3mal5@qlink.queensu.ca>  <http://qlink.queensu.ca/~3mal5/>
  32.  
  33. "If I really knew how to write, I could write something that someone
  34. could read and it would kill them."  -  william s. burroughs
  35.  
  36.  
  37.